Skip to content


ardupilot  None  ros2  dds  micro ros  xrce  lua  sitl  scripts  plugin  gazebo  garden  SITL  debug  rangefinder  pymavlink  mavros  distance sensor  system_time  timesync  ardurover  script  cheat sheet  mavlink  wireshark  mavproxy  mission planner  cmake  gtest  ctest  101  cpp  c++  format  fmt  smart pointers  multithreading  spdlog  cyclonedds  eprosima  fastdds  aptly  apt  repository  repo  local  mirror  encryption  pgp  docker  arm  container  state  networking  network  nvidia  python  app  devcontainer  gui  tutorial  tips  volume  mount  compose  multi-stage  stage  docker compose  microsoft  dotnet  .net  c#  vscode  git  bundle  backup  submodules  github  hooks  pre-commit  marpit  presentation  marp  markdown  mermaid  mkdocs  qml  qt  qtcreator  video  ffmpeg  gstreamer  cheat-sheet  sdp  opencv  appsrc  appsink  acceleration  va-api  intel  v4l2loopback  pipe  compositor  alpha  shmsink  shmsrc  intersink  intersrc  tee  queue  udp  stream  gst  binding  gi  kml  geo  gis  spatial  gdal  ogr  raster  vector  qgc  qgroundcontrol  snippets  cheat Sheet  asyncio  event  future  thread  task  can  canbus  click  cli  cupy  numpy  gpu  dataclass  slots  dev container  fastapi  rest  uvicorn  deb  debian  package  setup  stdeb  project  jupyter  widgets  interactive  plot  matplotlib  ipywidgets  3d  subplot  open3d  point cloud  template  black  isort  templates  cookiecutter  docs  project document  docstrings  flake8  linter  git-hook  mypy  unittest  pytest  pylint  from a-z  fixture  scope  logging  pytest.ini  mock  parameterize  enum  flag  iterator  generator  yaml  yml  logging config  tuple  namedtuple  typing  annotation  generic  literal  protocol  self  typed dict  typevar  pyzmq  zmq  msgpack  slam  cartographer  slam_toolbox  action  namespace  remap  control2  demo  diff-drive  ignition  ros2_control  effort  velocity  gdb  qos  tag  plugins  msg  node  zero-copy  shm  rmw  discovery  zenoh  bridge  zenoh-plugin-ros2dds  algorithm  calibration  diff  pid  dev  colcon  colcon_cd  clean  custom  bloom  settings  behavior  py_trees  bt  behavior_trees  blackboard  visualization  debugging  diagnostic  DiagnosticTask  diagnostics  tutorials  math  apm  rat_runtime_monitor  bag  rosbag  rosbags  tools  ros  smach  state machine  web  rosbridge  vue  profile  gazebo-classic  launch  spawn  model  cook  camera  sensors  gps  imu  ray  gazebo_ros_ray_sensor  lidar  ultrsonic  range  ultrasonic  gazebo classic  wrench  gazebo_ros_state  gz  sdf  world  vscode tips  gazebogz-sim-joint-position-controller-system  simulation  ros_gz_bridge  ign  xacro  diff_drive  odom  odometry  joint_state  argument  OpaqueFunction  DeclareLaunchArgument  LaunchConfiguration  tmux  tmuxp  nav  nav2  turtlebot  perception  test  rclpy  goal abort  cancel goal  action client  action server  custom messages  executor  MultiThreadedExecutor  SingleThreadedExecutor  lifecycle  parameter  param  dynamic-reconfigure  get  global server  persist_parameter  service  client  setup.py  package.xml  parameters  msgs  executers  pub  sub  rqt  rviz  rviz2  pose  marker  tf2  local_setup  rosdep  package manager  project settings  vcstool  urdf  robot_state_publisher  urdf_to_graphiz  joint  link  rust  deep learning  ai  beginner  regression  reinforcement learning  q learning  gym  gymnasium  deepsort  onnx  inference  build  source  wheel  cuda  vision  siam-mask  tracking  segmentation  yolo  ultralytics  yolov8  jetson  tensorrt  rest api  js  javascript  async  cross-compiler  esp32  nano  i2c  adafruit  arduino  sensor  mb1202  uart  serial  tfmini  gpio  embedded  rpi  raspberry pi  arducam  teensy  microros  udev  rule  usb  micro python  pymakr  config  material  workshope  texture  joints  loop device  rootfs  zah  linux  rm  ubuntu  sudo  sudoers  nopasswd  visudo  shell  key  gpg  sign  commands  update-alternative  dpkg  ip  ss  netstat  snap  deploy  ssh  systemd  socat  tc  mtu  select  robotics  path planning  trajectory  speed  pcl  kalman_filter  kalman  filter  control  code  extensions  remote  json  schema  yocto  poky  qemu  projects  courses to follow  matrix  graphics  rotation  2d  course  drone  quad  uav  geometric control  se3  so3  joint_states  JointState  Header  vrx  buoyancy 

Ardupilot SITL with Gazebo simulator#

Objective#

Run Ardupilot (copter) SITL and gazebo simulation

  • Gazebo garden
  • ardupilot_gazebo (plugin)
  • MAVProxy

ardupilot_gazebo#

# Clone ardupilot_gazebo repository
# git subfolder

mkdir ~/git
cd git
# git clone -b <branchname> <remote-repo-url>
git clone https://github.com/ArduPilot/ardupilot_gazebo.git

Install#

more

sudo apt update
sudo apt install libgz-sim7-dev rapidjson-dev
cd aurdupilot_gazebo
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4

Run#

terminal1
export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/git/ardupilot_gazebo/build:${GZ_SIM_SYSTEM_PLUGIN_PATH}
export GZ_SIM_RESOURCE_PATH=$HOME/git/ardupilot_gazebo/models:$HOME/git/ardupilot_gazebo/worlds:${GZ_SIM_RESOURCE_PATH}

# note remove sky tag from sdf
gz sim -v 4 -r iris_runway.sdf

-r: run simulation on start -v 4: verbose mode

SITL#

sim_vehicle#
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
Manual#
terminal2 - run SITL
./arducopter -S --model JSON \
--speedup 1 \
--defaults copter.parm,gazebo-iris.parm \
-I0

MAVProxy#

mavproxy
mavproxy.py --master tcp:127.0.0.1:5760

# Arm and takeoff
mode guided
arm throttle
takeoff 5


Basic Worlds and models#

iris_with_ardupilot iris_with_standoff, liftdrag and ardupilot plugins
iris_with_gimbal iris_with_standoff, gimbal_small_2d, liftdrag and ardupilot plugins
gimbal_small_2d Camera sensor declare on tilt_link

Note

In my computer the sky flickering so i comments them

<scene>
  <ambient>1.0 1.0 1.0</ambient>
  <background>0.8 0.8 0.8</background>
  <!-- <sky></sky> -->
</scene>

Note

Change model to iris_with_gimbal

<include>
  <uri>model://iris_with_gimbal</uri>
  <pose degrees="true">0 0 0 0 0 90</pose>
</include>

by default camera topic name generate by sensor location

/world/iris_runway/model/iris_with_gimbal/model/gimbal/link/tilt_link/sensor/camera/image
#

Reference#